package com.zhou.jiancai.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.widget.TextView;

import java.util.List;

/**
 * Created by Administrator on 2017/8/15.
 */

public class FragAdapter  extends FragmentPagerAdapter{
    private List<Fragment> Mfragments;
    private String[] Mtitles;
    public FragAdapter(FragmentManager fm,List<Fragment> fragments,String[] titles) {
        super(fm);
        Mfragments=fragments;Mtitles=titles;
    }

    @Override
    public Fragment getItem(int position) {
        return Mfragments.get(position);
    }

    @Override
    public int getCount() {
        return Mfragments.size();
    }

    /*为了让tablayout显示title*/

    @Override
    public CharSequence getPageTitle(int position) {
        return  Mtitles[position];
    }
}
